/*    */ package com.wzh.action.system;
/*    */ 
/*    */ import com.opensymphony.xwork2.ActionContext;
/*    */ import com.opensymphony.xwork2.ActionSupport;
/*    */ import com.wzh.bean.book.BookType;
/*    */ import com.wzh.bean.user.UserInfo;
/*    */ import com.wzh.service.bookinfo.booktype.BookTypeService;
/*    */ import com.wzh.service.user.UserService;
/*    */ import com.wzh.utils.MD5;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import javax.annotation.Resource;
/*    */ import org.springframework.stereotype.Controller;
/*    */ 
/*    */ @Controller
/*    */ public class SystemAction extends ActionSupport
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */ 
/*    */   @Resource
/*    */   private BookTypeService bookTypeService;
/*    */ 
/*    */   @Resource
/*    */   private UserService userService;
/*    */ 
/*    */   public String init()
/*    */   {
/* 32 */     if (this.bookTypeService.getCount() > 0L) {
/* 33 */       ActionContext.getContext().put("message", "系统已经初始化，请不要重复执行");
/*    */     } else {
/* 35 */       List booktypes = new ArrayList();
/* 36 */       booktypes.add(new BookType("玄幻小说"));
/* 37 */       booktypes.add(new BookType("重生文学"));
/* 38 */       booktypes.add(new BookType("科幻小说"));
/* 39 */       booktypes.add(new BookType("网游小说"));
/* 40 */       booktypes.add(new BookType("历史小说"));
/* 41 */       booktypes.add(new BookType("都市小说"));
/* 42 */       booktypes.add(new BookType("仙侠修真"));
/* 43 */       booktypes.add(new BookType("武侠小说"));
/* 44 */       booktypes.add(new BookType("其他"));
/* 45 */       this.bookTypeService.addBookTypes(booktypes);
/*    */ 
/* 48 */       UserInfo user = new UserInfo();
/* 49 */       user.setUsername("admin");
/* 50 */       user.setPassword(MD5.MD5Encode("aa890322"));
/*    */ 
/* 52 */       this.userService.save(user);
/* 53 */       ActionContext.getContext().put("message", "系统初始化成功");
/*    */     }
/*    */ 
/* 56 */     ActionContext.getContext().put("urladdress", "/control/index");
/* 57 */     return "message";
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     com.wzh.action.system.SystemAction
 * JD-Core Version:    0.6.1
 */